﻿<cfscript>
/** 
* Senate Frameworks cetProperty
* 
* @hint "The CET property object handler." 
*/ 

component 
	displayname="public.service.handler.cetProperty" 
	output=false 
	accessors=true 
	{

	/* PROPERTIES */
	property type="boolean" name="Running" default="false" hint="该科目是否可报考";
	
	/**
	* @hint "初始化对象"
	* 
	* @Running "该科目是否可报考"
	*/
	public public.service.handler.cetProperty function init( boolean Running=false ) output=false {

		setRunning( arguments.Running );
		
		return this;
	}
	
	/**
	* @hint "将上述属性转换为属性字符串"
	*/
	public string function stringProperty() output=false {
		
		var prop = "";
		
		/* 执行序列化 */
		if (getRunning()) { prop = prop & "1"; } else { prop = prop & "0"; }
		
		return left(prop & "000000000000000000000000000000", 30);
		
	}
	
	/**
	* @hint "将属性字符串转换为对象属性"
	* 
	* @fString "属性字符串"
	*/
	public void function parseProperty( required string fString ) output=false {
		var i = 0;
		
		for (i=1; i <= len(arguments.fString); i++) {
			
			switch (i) {
				
				case 1:
					/* 第1位 该科目是否可以报考 */
					if (yesNoFormat(mid(arguments.fString, i, 1))) { setRunning(true); } else { setRunning(false); }
					break;
			
			}
		}
	}

}

</cfscript>
